package com.guli.gulimall.product.web.controller;

import com.guli.gulimall.product.entity.CategoryEntity;
import com.guli.gulimall.product.service.CategoryService;
import com.guli.gulimall.product.vo.CateLogVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
public class IndexController {

    @Autowired
    CategoryService categoryService;
    @RequestMapping(value = {"/","/index"})
    public String index(Model model){
        List<CategoryEntity> list = categoryService.getcategorylevel();
        model.addAttribute("list",list);
        return "index";
    }

    @RequestMapping("/catelogList")
    @ResponseBody
    public Map<Long,List<CateLogVo>> catelogList(){
        return categoryService.catelogList();
    }
}
